lapop12 = readRDS('data/lapop12.rds')

#### Time Series of Respondents ##### 

ts <- lapop12 %>% 
  group_by(trend) %>% 
  summarize(soc.cl_bin  = mean(soc.cl_bin, na.rm = T), 
            torture_bin = mean(torture_bin, na.rm = T), 
            fair_trial = mean(fair_trial, na.rm = T), 
            n = n())

tshist <- ggplot(ts, aes(x = trend, y = n)) +
  geom_point() +
  geom_smooth(data = subset(ts, trend < 0), method = "loess",  se = T) + 
  geom_smooth(data = subset(ts, trend > -1), method = "loess",  se = T) + 
  geom_rect(aes(xmin=0, xmax=Inf, ymin=-Inf, ymax=Inf), alpha = .01) + 
  xlab("Event Time") +
  ylab("Number of Respondents") +
  ggtitle("Respondent Density by Day") +
  theme_tufte()

tshist

ggsave("fig-out/densityts.pdf", width = 10)
